<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>设备管理</title>
<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="../css/common2.css">
	<link rel="stylesheet" href="../css/layui.css" />
	<style>
		.layui-row {
			margin-top: 50px;
		}

		.offer {
			width: 90px;
			height: 35px;
			background: #0086b6;
			color: white;
			text-align: center;
			line-height: 35px;
			font-size: 16px;
			border-radius: 4px;
		}

		.return {
			width: 80px;
			height: 35px;
			background: #0086b6;
			color: white;
			text-align: center;
			line-height: 35px;
			margin-top: -35px;
			margin-left: 130px;
			font-size: 16px;
			border-radius: 4px;
		}
	</style>
</head>

<body>

	<div class="layui-row" id="vue-root">
		<div></div>
		<div class="layui-col-md6 layui-col-md-offset3">
			<div class="layui-form-item">
				<label class="layui-form-label">学校名称</label>
				<div class="layui-input-block">
					<select name="schoolName" v-validate="'required'" class="layui-input school" v-model="item.schoolId"
						:disabled="!!item.id">
						<option :value="undefined">请选择学校</option>
						<option v-for="school in schools" :key="school.id" :value="school.id" v-text="school.name">
						</option>
					</select>
					<div class="checkout_state" v-text="err('schoolName')"></div>
				</div>

			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">设备位置</label>
				<div class="layui-input-block">
					<input name="deviceName" v-validate="'required'" autocomplete="off" placeholder="请输入考勤设备"
						class="layui-input name" v-model="item.name">
					<div class="checkout_state" v-text="err('deviceName')"></div>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">设备编码</label>
				<div class="layui-input-block">
					<input name="deviceCode" :disabled="edit" v-validate="'required'" autocomplete="off"
						placeholder="请输入设备编码" class="layui-input tag" v-model="item.code">
					<div class="checkout_state" v-text="err('deviceCode')"></div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label" style="margin-top: -10px;">学生进校<br>语音模板</label>
				<div class="layui-input-block">
					<input name="sTemplateIn" autocomplete="off" placeholder="例：[className][name]来了"
						class="layui-input tag" v-model="item.sTemplateIn">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="margin-top: -10px;">学生离校<br>语音模板</label>
				<div class="layui-input-block">
					<input name="sTemplateOff" autocomplete="off" placeholder="例：[className][name]离校"
						class="layui-input tag" v-model="item.sTemplateOff">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="margin-top: -10px;">老师进校<br>语音模板</label>
				<div class="layui-input-block">
					<input name="tTemplateIn" autocomplete="off" placeholder="例：[name]好" class="layui-input tag"
						v-model="item.tTemplateIn">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label" style="margin-top: -10px;">老师离校<br>语音模板</label>
				<div class="layui-input-block">
					<input name="tTemplateOff" autocomplete="off" placeholder="例：[name]下班了" class="layui-input tag"
						v-model="item.tTemplateOff">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label" style="margin-top: -10px;">标语</label>
				<div class="layui-input-block">
					<input name="slogan" autocomplete="off" placeholder="" class="layui-input tag"
						v-model="item.slogan">
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<div class="offer" @click="submit">立即提交</div>
					<div class="return" onclick="history.back()">取消</div>
				</div>
			</div>
		</div>
	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>


	<script src="/scriptZIP/axios.min.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/item.js"></script>

	<script>
		var app = new Vue(merge({
			data: {
				item: {
					schoolId: null,
				},
				url: '/pc/device',
				edit: false,
				schools: [],
			},
			created: function () {
				var agentId = top_params().id;
				var id = params().id;
				if (id) this.edit = true;
				axios.get('/pc/school/all/' + agentId).then(function (res) {
					this.schools = res.data;
				}.bind(this));
				this.init();
			},
		}));
	</script>
</body>

</html>